import request from '@/utils/request'

// 查询设备管理列表
export function listEquipment(query) {
  return request({
    url: '/iot/equipment/list',
    method: 'get',
    params: query
  })
}
// 查询设备管理列表
export function listEquipmentAll(query) {
  return request({
    url: '/iot/equipment/listAll',
    method: 'get',
    params: query
  })
}
// 查询设备管理列表
export function relay(num,node,topic) {
  return request({
    url: '/iot/equipment/relay',
    method: 'get',
    params: {
      node:node,
      topic:topic,
      num:num
    }
  })
}
// 查询设备管理列表
export function relays(num,node,node1,topic) {
  return request({
    url: '/iot/equipment/relays',
    method: 'get',
    params: {
      node:node,
      node1:node1,
      num:num,
      topic:topic
    }
  })
}
// 查询设备管理列表
export function listEquipmentByGruop(query) {
  return request({
    url: '/iot/equipment/listByGruop',
    method: 'get',
    params: query
  })
}
// 查询设备管理列表
export function histroyList(query) {
  return request({
    url: '/iot/equipment/histroyList',
    method: 'get',
    params: query
  })
}
// 查询设备管理列表
export function histroyListPage(query) {
  return request({
    url: '/iot/equipment/histroyListPage',
    method: 'get',
    params: query
  })
}
// 查询设备管理详细
export function getEquipment(id) {
  return request({
    url: '/iot/equipment/' + id,
    method: 'get'
  })
}

// 新增设备管理
export function addEquipment(data) {
  return request({
    url: '/iot/equipment',
    method: 'post',
    data: data
  })
}

// 修改设备管理
export function updateEquipment(data) {
  return request({
    url: '/iot/equipment',
    method: 'put',
    data: data
  })
}

// 删除设备管理
export function delEquipment(id) {
  return request({
    url: '/iot/equipment/' + id,
    method: 'delete'
  })
}

// 设置最大最小值
export function setMinMax(data) {
  return request({
    url: '/iot/equipment/edits',
    method: 'put',
    data: data
  })
}

export function setTime(data) {
  return request({
    url: '/iot/equipment/setTime',
    method: 'post',
    data:data
  })
}

export function getTimeEnd() {
  return request({
    url: '/iot/equipment/getTime',
    method: 'get',
  })
}
